﻿using DataModels.Enums.ShoppingMall;
using SqlSugar;
using static DataModels.Enums.GeneralEnum;

namespace DataModels.Entities.ShoppingMall
{
    [SugarTable]
    public class ShoppingMallOrderTotal
    {
        [SugarColumn(IsPrimaryKey = true)]
        public Guid UUID { get; set; }

        /// <summary>   
        /// 订单编号
        /// </summary>
        public string OrderNo { get; set; } = Utils.MicrosecondTimeStamp.GenerateUniqueId();

        /// <summary>
        /// 订单金额
        /// </summary>
        public decimal OrderAmount { get; set; }

        /// <summary>
        /// 支付金额
        /// </summary>
        public decimal PayAmount { get; set; } = 0;

        /// <summary>
        /// 优惠金额
        /// </summary>
        public decimal DiscountAmount { get; set; } = 0;

        /// <summary>
        /// 退款金额
        /// </summary>
        public decimal RefundAmount { get; set; } = 0;


        /// <summary>
        /// 订单状态
        /// </summary>
        public ShoppingMallOrderStatus OrderStatus { get; set; } = ShoppingMallOrderStatus.PendingPayment;

        /// <summary>
        /// 收货地址
        /// </summary>
        public string Address { get; set; }

        /// <summary>
        /// 联系人姓名
        /// </summary>
        public string ContactPerson { get; set; }

        /// <summary>
        /// 联系电话
        /// </summary>
        public string ContactPhone { get; set; }

        /// <summary>
        /// 订单过期时间 - 默认未付款24小时后过期
        /// </summary>
        public DateTime? ExpireTime { get; set; } = DateTime.Now.AddMinutes(60 * 24);

        public DateTime CreateTime { get; set; } = DateTime.Now;
        public DateTime UpdateTime { get; set; }

        public Guid CreateUserUUID { get; set; }

        public Guid UpdateUserUUID { get; set; }

        /// <summary>
        /// 删除标记
        /// </summary>
        public Status IsDeleted { get; set; } = Status.Disable;

        /// <summary>
        /// 子订单
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<ShoppingMallOrder> Orders { get; set; }
    }
}
